<template>
  <el-container>
    <basic-crud v-model="formData" :option="option" businessUrl="/bd/cityController">
    </basic-crud>
  </el-container>
</template>

<script setup>
const formData = ref({})
const option = {
  menuWidth: 250,
  searchShow: false,
  selection: false,
  isTableTree: true,
  addSonBtn: true,
  column: [
    {
      label: "编号",
      prop: "code",
      search: true,
      minWidth: 100,
      sortable: true,
      rules: [{ required: true, message: "编号不能为空" }],
    },
    {
      label: "名称",
      prop: "name",
      minWidth: 100,
      search: true,
      sortable: true,
      rules: [{ required: true, message: "名称不能为空" }],
    },
    {
      label: "排序",
      prop: "orderNum",
      width: 120,
      type: "number",
      sortable: true,
      step: 10,
      rules: [
        { required: true, message: "编号不能为空", trigger: 'blur', }
      ],
    }, {
      label: "是否热门",
      prop: "hot",
      type: "switch",
      value: "false",
      width: 150,
      enumCode: 'trueFalseDic'
    }, {
      label: "是否国外",
      prop: "feign",
      width: 150,
      type: "switch",
      value: "false",
      enumCode: 'trueFalseDic'
    }, {
      prop: "province",
      label: "所属省份",
      sortable: true,
      component: 'BasicCrudInputTree',
      referType: 'province',
      saveFieldMap: { province: 'name' },
      curForm: formData,
      comProps: {
        props: { label: 'name', value: 'name' },
      },
      change: (val) => {
        formData.value = val
      },
    },
    {
      label: "描述",
      type: 'textarea',
      span: 24,
      prop: "des",
      sortable: true,
    },
  ],
}
</script>

<style lang="scss" scoped></style>
